package com.xsmart.order.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.order.services.OrderFillsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author pansheng
 */
@RestController
@RequestMapping("api")
public class OrderManageController {



    @Autowired
    OrderFillsService orderFillsService;

    /**订单查询
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @PostMapping(value = "/v1/OrderFillsService/queryOrderFills")
    public Object queryOrder(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest) {
        return orderFillsService.queryOrder(requestBean);
    }


    /**新建订单
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @PostMapping(value = "/v1/OrderFillsService/addOrderFills")
    public Object addOrder(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest) {
        return orderFillsService.addOrder(requestBean);
    }

    /**订单详情查询
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @PostMapping(value = "/v1/OrderFillsService/queryOrderDetails")
    public Object queryOrderDetails(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest) {
        return orderFillsService.queryOrderDetail(requestBean);
    }

    /**订单评价
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @PostMapping(value = "/v1/OrderFillsService/queryOgaText")
    public Object queryOgaText(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest) {
        return orderFillsService.queryOgaText(requestBean);
    }

    /**修改订单状态
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @PostMapping(value = "/v1/OrderFillsService/changeStatus")
    public Object changeStatus(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest) {
        return orderFillsService.changeStatus(requestBean);
    }


}
